package com.gitee.neuray.security.wb.ribs.util.wechat;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class RedirectURLTool {

    private static final String CONNECT_OAUTH2_AUTHORIZE_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s";

    /**
     * 生成应用路径工具
     * @param args
     */
    public static void main(String[] args) {
        String a = CONNECT_OAUTH2_AUTHORIZE_URL +
                "&response_type=%s&scope=%s&state=%s#wechat_redirect";
        System.out.println(URLEncoder.encode("http://7dkyir.natappfree.cc/app/addressList"));
        try {
            System.out.println(String.format(a,"wwacc92a7b917bf282",
                    URLEncoder.encode("http://7dkyir.natappfree.cc/app/addresslist","UTF-8"),"code","snsapi_base","STATE"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}
